#include<iostream>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;
template<typename T> 
inline void read(T &x){
	x=0;T f=1;char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

struct node{
  int a,b;
  bool operator<(const node&x)const{
    return b>x.b;
  }
};
void exgcd(ll a, ll b, ll& x, ll& y) {
  if (b == 0) {
    x = 1, y = 0;
    return;
  }
  exgcd(b, a % b, y, x);
  y -= a / b * x;
}
ll gcd(ll a,ll b){
  if(b==0)return a;
  return gcd(b,a%b);
}
ll mul(ll a,ll b,ll q){
  ll rt=0;
  while(a){
    if(a&1)rt=(rt+b)%q;
    b=(b+b)%q;
    a>>=1;
  }
  return rt;
}
ll qs(ll a,ll b,ll q){
  ll res=1;
  while(b){
    if(b&1)res=mul(res,a,q);
    a=mul(a,a,q);
    b>>=1;
  }
  return res;
}
//P2054
int main(){
    #ifdef BUG
    freopen("a.in","r",stdin);
    #endif
    ll n,m,l;
    read(n);read(m);read(l);
    ll t=qs(2,m,n+1);
    ll x,y;
    exgcd(t,n+1,x,y);
    x=(x%(n+1)+n+1)%(n+1);
    l=l%(n+1);
    cout<<(mul(x,l,n+1)%(n+1))<<endl;
}
